import fetch from '@/utils/fetch'
import { EBIZ_API } from '@/config/baseUrl';

//拉取新闻列表
export function getArticleList(params){
	return fetch({
		url: '/info/v1/mgt/article',
		method: "get",
		params
	})
}

// 拉取详情
export function getArticleDetail(id) {
	return fetch({
		url: `/info/v1/mgt/article/${id}`,
		method: "get"
	})
}

// 修改
export function modifyArticle(id, data) {
	return fetch({
	    url: `/info/v1/mgt/article/${id}`,
	    method: 'patch',
	    data
  	})
}

// 修改
export function addArticle(data) {
	return fetch({
	    url: `/info/v1/mgt/article`,
	    method: 'post',
	    data
  	})
}

export const publishUserTypeScope = {
	1: '业主',
	2: '员工'
};

export const noticeTypeList = {
	2: '通知',
	3: '公告'
};

export const staffNewsTagList = [
	{
		label: "生活百科",
		value: "生活百科"
	},
	{
		label: "社区活动",
		value: "社区活动"
	},
	{
		label: "便民资讯",
		value: "便民资讯"
	},
	{
		label: "社区动态",
		value: "社区动态"
	}
];

export const residentNewsTagList = [
	{
		label: "集团要闻",
		value: "集团要闻"
	},
	{
		label: "物业动态",
		value: "物业动态"
	},
	{
		label: "实时资讯",
		value: "实时资讯"
	}
];

//拉取七牛凭证
export function getQNToken(){
	return fetch({
		url: '/misc/v1/qiniu/up_token',
		method: 'get'
	})
}

//新增简报
export function addBriefing(data){
	return fetch({
		url: '/info/v1/mgt/h5',
		method: 'POST',
		data
	})
}

//拉取简报列表
export function getBriefingList(params){
	return fetch({
		url: '/info/v1/mgt/h5',
		method: 'get',
		params
	})
}

//拉取简报详细
export function getBriefingDetail(id){
	return fetch({
		url: `/info/v1/mgt/h5/${id}`,
		method: 'get'
	})
}

//删除简报
export function deleteBriefing(id){
	return fetch({
		url: `/info/v1/mgt/h5/${id}`,
		method: "delete"
	})
}

//修改简报
export function editBriefing(id,data){
	return fetch({
		url: `/info/v1/mgt/h5/${id}`,
		method: "patch",
		data
	})
}

//删除新闻
export function deleteNews(a_id){
	return fetch({
		url:`/info/v1/mgt/article/${a_id}`,
		method:"delete"
	})
}

//拉取广告列表
export function getBannerList(params){
	return fetch({
		url:"/info/v1/mgt/banner",
		method:"get",
		params
	})
}

//新增广告
export function addBanner(data){
	return fetch({
		url:"/info/v1/mgt/banner",
		method:"post",
		data
	})
}

//拉取广告详情
export function getBannerDetail(banner_id){
	return fetch({
		url:`/info/v1/mgt/banner/${banner_id}`,
		method:"get"
	})
}

//修改广告
export function updateBanner(banner_id,data){
	return fetch({
		url:`/info/v1/mgt/banner/${banner_id}`,
		method:"patch",
		data
	})
}

//删除广告
export function deleteBanner(banner_id){
	return fetch({
		url:`/info/v1/mgt/banner/${banner_id}`,
		method:"delete"
	})
}

//拉取闪屏管理数据
export function getFlash(flash_type){
	return fetch({
		url:`/misc/v2/flash/detail/${flash_type}`,
		method:"get"
	})
}

//编辑闪屏管理数据
export function updateFlash(flash_type,data){
	return fetch({
		url:`/misc/v2/flash/${flash_type}`,
		method:"post",
		data
	})
}